<?php
require_once 'src/car/car.class.php';
class SearchDao {
	function search($entSearch) {
		$mdb2 = $GLOBALS['objMDB2'];
		$query = 'SELECT id,make, model,price,color,photo FROM car';
		$cars = $mdb2->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
		foreach ($cars as $row) {
 	   		$car = new Car($row['id'],$row['make'],$row['model'],$row['price'],$row['color'],$row['photo']);
			$carList[] = $car;
		}
		return $carList;
	}
	
	function getArrMake() {
		$mdb2 = $GLOBALS['objMDB2'];
		$query = 'SELECT id,name FROM make';
		$makes = $mdb2->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
		$arrMake[] = "------------------"; 
		foreach ($makes as $row) {
			$arrMake[$row['id']] = $row['name'];
		}
		return $arrMake;
	}
	
}
?>